local ClientOHOH = _G.ClientOHOH;
--local M = ClientOHOH.class.new(script, ClientOHOH.files.Client_PlayerComponent());
local M = _G.ClientOHOH.class.new(script,_G.ClientOHOH.files.Client_PlayerComponent(),script.Parent.Name)
local UIManager = ClientOHOH.load.UIManager();
local CarStoreGui = ClientOHOH.load.UIManager():CreateUI("CarStoreGui",require(script.CarStoreGui))

local CallBackManager = ClientOHOH.load.CallBackManager();
local ConnectClass = _G.CommonOHOH.load.Connect();
local game_cfg = ClientOHOH.config.Game
local FunctionList = ClientOHOH.load.FunctionList();
function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent)
    self.player=self.parent

    self.DataBase=self.player:GetComponent(_G.ClientOHOH.load.Client_PlayerDataComponent())
   
    local data=self.DataBase:GetData("car")

    CallBackManager:AddRbxConnect(self,CarStoreGui.SkinMakeUpEvent, function()
        print("装扮确认")
        local cell = CarStoreGui:GetList():GetSelectCell()
        if cell then
            local carId  = CarStoreGui:GetList():GetSelectCell():GetCarId()
       -- local carId =carCfg.carId
		    local isReceive = self:Invoke(FunctionList.skin_makeup,carId)
        end
     end);
     CallBackManager:AddRbxConnect(self,CarStoreGui.NewMakeUpEvent, function()
		    local isReceive = self:Invoke(FunctionList.new_makeup)
     end);
    --测试UI接口
    -- CarStoreGui:接口1（假数据）
    -- CarStoreGui:接口2（假数据）
    CarStoreGui:SetDataBase(self.DataBase)
    CarStoreGui:UpdateHad(data)--装备更新在Had更新中

    CarStoreGui:UpdateStoreInfo(80)--参数是仓库上限
   -- CarStoreGui:Show()
    CarStoreGui:Hide()
    self.UserDataEventConnect=self.parent.UserDataEvent:Connect(function(data)
        -- 调用顺序不可更改
		if data["car"] then
         CarStoreGui:UpdateHad(data["car"])
		end
	end)
end;

function M.dtor(self)
	M.super.dtor(self);
end;

return M